package com.ins1st.modules.xs.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ins1st.modules.xs.entity.Student;

public interface StudentMapper extends BaseMapper<Student> {

	@Select("select * from student")
	public List<Student> findAll();
	
	@Select("select * from student where name like #{name} and age>=#{age}")
	public List<Map<String, Object>> findAll2(@Param("name")String name, @Param("age")int age);
	
	@Select("select x.*, y.name as cname from student x left join clazz y on x.clazz_id=y.id")
	public List<Map<String, Object>> findPage(IPage<?> page);
	
	// 使用XML文件
	public List<Student> find4();
	public List<Map<String, Object>> find5(@Param("name")String name, @Param("age")int age);
	public List<Map<String, Object>> find6(IPage<?> page);
	
	// FIXME：在xml文件中，使用动态SQL
	@Select("select * from student where name like #{name} and age>=#{age}")
	public List<Map<String, Object>> findAll2(Student student);
}

